package com.wmzdq.photocenter.common;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.context.request.NativeWebRequest;

@ControllerAdvice
public class ControllerAdviceTest {

	 protected static Logger logger = LoggerFactory.getLogger(ControllerAdviceTest.class);  
     
	    @ExceptionHandler(Exception.class)  
	    @ResponseStatus(HttpStatus.BAD_REQUEST)  
	    public String processUnauthenticatedException(NativeWebRequest request,Exception e) {  
	        logger.error(e.getMessage());  
	        System.out.println(e.getMessage());
	        e.printStackTrace();
	        return "viewName"; //返回一个逻辑视图名  
	    }  
}
